<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">

    <ui:define name="title">API基础项配置编辑</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{templateItemInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{templateItemInfoBean.isView()}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{templateItemInfoBean.onSave}"
                                         rendered="#{templateItemInfoBean.isNotView() }"
                                         update="@form"/>
                        <p:commandButton value="取消" icon="fa fa-reply"
                                         actionListener="#{templateItemInfoBean.changeStatusToView}"
                                         rendered="#{templateItemInfoBean.isEdit()}"
                                         process="@this"
                                         update="@form"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>基础项信息</h1>
                            <p:panelGrid columns="4"
                                         columnClasses="ui-grid-col-2,ui-grid-col-4,ui-grid-col-2,ui-grid-col-4"
                                         layout="grid" styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">

                                <p:outputLabel for="type" value="实现方式"/>
                                <p:selectOneMenu id="type" value="#{templateItemInfoBean.$.typeId}" disabled="#{templateItemInfoBean.isView()}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems value="#{templateItemInfoBean.modelTypeList}" var="model"
                                                   itemLabel="#{model.typeName}"  itemValue="#{model.id}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="project" value="所属大项"/>
                                <p:selectOneMenu id="project" value="#{templateItemInfoBean.$.projectId}"  disabled="#{templateItemInfoBean.isView()}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems value="#{templateItemInfoBean.modelProjectList}" var="model"
                                                   itemLabel="#{model.title}" itemValue="#{model.id}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="title" value="一级项名"/>
                                <p:inputText id="title" value="#{templateItemInfoBean.$.title}"
                                             disabled="#{templateItemInfoBean.isView()}"/>

                                <p:outputLabel for="dataKey" value="内部Key名"/>
                                <p:inputText id="dataKey" value="#{templateItemInfoBean.$.dataKey}"
                                             disabled="#{templateItemInfoBean.isView()}"/>

                            </p:panelGrid>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>